/*
 * Roler.h
 *
 *  Created on: 2015-9-22
 *      Author: 10095427
 */

#ifndef ROLER_H_
#define ROLER_H_

#include "cocos2d.h"
USING_NS_CC;

typedef enum {
    RolerTypeNone,
    RolerTypePrincess,
    RolerTypePrince,
    RolerTypeBoss1,
    RolerTypeMonster1,
    RolerTypeMonster2,
    RolerTypeMax,

} RolerType;

typedef enum {
    RolerDirectDown,
    RolerDirectLeft,
    RolerDirectRight,
    RolerDirectUp,
} RolerDirectType;

typedef enum {
	RolerActionTypeNone,
	RolerActionTypeQuery,
} RolerActionType;

typedef std::function<void(Ref*)> rolerMoveEndCallback;

class Roler : public cocos2d::Layer{
public:
	CC_SYNTHESIZE_READONLY(int , m_type, Type);
	CC_SYNTHESIZE_READONLY(bool , m_isTalk, IsTalk);
	Roler();
	virtual ~Roler();
    static Roler *create(int type);
    bool init(int type);
    void move(int direct,int steps);
    void moveAndNoDirectionChange(int direct,int steps);
    void setDirection(int direct);
    void setCallback(const rolerMoveEndCallback& callback);
    void talk(const char* content);
    void showAction(int type);


protected:
    rolerMoveEndCallback m_callback;
private:
    Sprite *m_rolerSprite;
    __Array *m_moveActionsArray;
    void moveActionInit();
    const char* getFileByType();
    void moveEndCallback(Node *node);
    void talkEndCallback(Node *node);
    void actionEndCallback(Node *node);
    const char* getActionFileNameByType(int type);


};

#endif /* ROLER_H_ */
